﻿@using Website.CRUDServices
@using Location = Website.Models.Domain.Location
@using Profile = Website.Models.Domain.Profile
@using Region = Website.Models.Domain.Region
@{
    this.ViewBag.Title = "Network";
    this.Layout = "~/Views/_Shared/_Layout.cshtml";
    var Presentations = this.ViewData["Presentations"] as List<Presentation>;
    var Regions = this.ViewData["Regions"] as List<Region>;
    var Projects = this.ViewData["Projects"] as List<Project>;
    var ProfileView = this.ViewData["Profiles"] as Website.Models.ViewModels.ProfilesView;
    var NActivity = this.Model as Activity;
    Guid otherId = Guid.Empty;

    // errorhandling
    var errorMsg = new HtmlString(string.Empty);
    if (this.ViewData["ErrorMessage"] != null)
    {
        errorMsg = this.ViewData["ErrorMessage"] as HtmlString;
    }

}

@Html.Partial("~/Views/_Shared/LogView.cshtml", NActivity.ID)


<script type="text/javascript">
    //toggle script
    function toggle(id) {
        if (document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == "") {
            document.getElementById(id).style.display = 'block';
        } else {
            document.getElementById(id).style.display = 'none';
        }
    }
</script>
<!--toggle topic elaboration -->
@foreach (Presentation pres in Presentations.Where(x => (NActivity.NA.Presentations ?? new Guid[0]).Contains(x.ID)))
{
    if (pres.Name == "Andet")
    {
    <script>
        $(function () {
            toggle('andet_holder');
        });
    </script>
    }

}

@*// Product type*@
<fieldset class="chosenFields">
    <legend>Beskrivelse</legend>
    @NActivity.NA.ProductType
</fieldset>

@*// date*@
<fieldset class="chosenFields">
    <legend>Dato</legend>
    @if (NActivity.TimeOfActivity.HasValue)
    {
        @NActivity.TimeOfActivity.Value.ToShortDateString()}
</fieldset>


@*// location*@
<fieldset class="chosenFields">
    <legend>Lokation</legend>
    @foreach (Location loc in ProfileView.Locations.OrderBy(x => x.Name))
    {
        if (loc.ID == NActivity.Location)
        {
            @loc.Name <br />
        }
    }
</fieldset>

<fieldset class="chosenFields">
    <legend>National eller international</legend>
        <label><input type="radio" name="IsNational" value="true"  @if (NActivity.NA.IsNational.HasValue && NActivity.NA.IsNational.Value)
                                                            { @Html.Raw("checked")
                                                            } />National<br /></label>
        <label><input type="radio" name="IsNational" value="false"  @if (!NActivity.NA.IsNational.HasValue || !NActivity.NA.IsNational.Value)
                                                            { @Html.Raw("checked")
                                                            } />International</label>
</fieldset>

@*// Type chooser*@
<fieldset class="chosenFields">
    <legend>Hvilket type netværk er der tale om?</legend>

    @if (NActivity.NA.IsNetworkingEvent == true)
    {
        <input type="radio" name="NetworkType" value="IsNetworkingEvent" checked />
    }
    else
    {
        <input type="radio" name="NetworkType" value="IsNetworkingEvent" />
    }Netværksmøde<br />
    @if (NActivity.NA.IsConferenceEvent == true)
    {
        <input type="radio" name="NetworkType" value="IsConferenceEvent" checked />
    }
    else
    {
        <input type="radio" name="NetworkType" value="IsConferenceEvent" />
    }Konference<br />
    @if (NActivity.NA.IsDelegationTravel == true)
    {
        <input type="radio" name="NetworkType" value="IsDelegationTravel" checked />
    }
    else
    {
        <input type="radio" name="NetworkType" value="IsDelegationTravel" />
    }
    Delegationsrejse<br />
    @if (NActivity.NA.IsProductLaunch == true)
    {
        <input type="radio" name="NetworkType" value="IsProductLaunch" checked />
    }
    else
    {
        <input type="radio" name="NetworkType" value="IsProductLaunch" />
    }Produkt lancering<br />
</fieldset>

@* // ownerProjects chooser*@
<fieldset class="chosenFields">
    <legend>Alle projekter tilknyttet</legend>
    @foreach (Project proj in Projects.Where(x => (NActivity.OwnerProjects ?? new Guid[0]).Contains(x.ID)))
    {
        @proj.Name <br />
    }

</fieldset>

@*// profiles chooser*@
<fieldset class="chosenFields">
    <legend>Deltagere</legend>
    @foreach (Profile prof in ProfileView.Profiles.Where(x => (NActivity.Attendees ?? new Guid[0]).Contains(x.ID)))
    {
        @prof.Name <br />
    }
</fieldset>




<fieldset class="chosenFields">
    <legend>WT Rolle</legend>
    @(NActivity.NA.Booth.HasValue && NActivity.NA.Booth.Value ? "stand" : "")
    @(NActivity.NA.Attendance.HasValue && NActivity.NA.Attendance.Value ? "deltagelse" : "")
    @(NActivity.NA.Organizer.HasValue && NActivity.NA.Organizer.Value ? "Arrangør" : "")

</fieldset>

@*// Profiles chooser*@
<fieldset class="chosenFields">
    <legend>Understøttelse af virksomhedsdeltagelse</legend>
    @foreach (Profile prof in ProfileView.Profiles.Where(x => (NActivity.NA.SupportForBusinessAttendance ?? new Guid[0]).Contains(x.ID)))
    {
        @prof.Name <br />
    }
</fieldset>

@*// Presentations chooser*@
<fieldset class="chosenFields">
    <legend>Præsentationer</legend>
    @foreach (Presentation pres in Presentations.Where(x => (NActivity.NA.Presentations ?? new Guid[0]).Contains(x.ID)))
    {
        @pres.Name <br />
    }
</fieldset>

@*// field for specifying "andet"*@
<div class="formEntry open_hidden" id="andet_holder">
    <fieldset class="chosenFields">
        <legend>Specificéring af "Andet"</legend>
        @NActivity.NA.PresentationComment
    </fieldset>
</div>

<fieldset class="chosenFields">
    <legend>Kommentarer</legend>
    @NActivity.Commentary
</fieldset>



